package com.course.mapper;

import com.course.entity.Permission;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 后台用户权限表(访问资源页面功能标识，API接口等) Mapper 接口
 * </p>
 *
 * @author author
 * @since 2022-09-16
 */
public interface PermissionMapper extends BaseMapper<Permission> {

    @Select("SELECT DISTINCT p.`id` as Skey,p.*,p.`meta` as metaJson FROM role_permission rp  LEFT JOIN permission p on  p.id = rp.permission_id WHERE rp.role_id in (0,#{roleIds}) ")
    List<Permission> getRolePermissions(String roleIds);
}
